package com.zzf.观察者模式;

public class Goods extends Subject{

    private int price;

    public Goods(int price) {
        this.price = price;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        int priceVar = price - this.price;
        this.price = price;
        if (priceVar!=0)this.notifyAllObservers(priceVar);
    }
}
